Repository navigation
Add 'Open in...' dropdown for external apps - #175
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded@saddlepaddle has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 57 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
WalkthroughAdds external app launch and clipboard copy endpoints to the desktop TRPC API, an in-memory settings router for last-used app, UI to open or copy workspace paths (with hotkeys), worktreePath on active workspaces, removes the "Open Repository..." menu item, and adds several UI primitives and exports. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Renderer as WorkspaceHeader
participant TRPCClient as tRPC Client
participant ExtRouter as tRPC Router (external)
participant Main as Electron Main
participant OS as External App / Finder
User->>Renderer: click "Open in App" or press Meta+O
Renderer->>TRPCClient: external.openInApp({ path, app })
TRPCClient->>ExtRouter: openInApp request
ExtRouter->>ExtRouter: persist lastUsedApp in settings
alt app == "finder"
ExtRouter->>Main: shell.showItemInFolder(path)
else
ExtRouter->>ExtRouter: getAppCommand(app, path)
ExtRouter->>Main: spawnAsync(command, args)
end
Main->>OS: open/spawn external app
OS-->>Main: success / error
Main-->>ExtRouter: result
ExtRouter-->>TRPCClient: response
TRPCClient-->>Renderer: resolve mutation (close menu / update UI)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (5)
apps/desktop/src/lib/trpc/routers/settings/index.ts (1)
4-28: CentraliseExternalAppdefinition to avoid drift across routers and UIThis enum/string union is now defined here, in
external/index.ts, and again inWorkspaceHeader.tsx. They’re identical today but easy to desync later (e.g. when adding/removing apps). Consider moving a single source of truth (e.g. ashared/external-app.tsexporting both the Zod enum and TS union) and importing it in settings, external router, and the header.As per coding guidelines, this keeps shared types in a single place and reduces future mismatch risk.
apps/desktop/src/main/lib/menu.ts (1)
3-15: Consider clarifying or implementing theNew Windowmenu actionThe
New Windowitem’s click handler is currently a no-op (async () => {}). If opening a new BrowserWindow isn’t implemented yet, adding a brief TODO or removing the item until it’s wired up would avoid user confusion.apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsx (1)
69-88: Centralise new hotkeys alongside existingHOTKEYSentriesThe
meta+oandmeta+shift+cbindings work as written, but they’re hard-coded here while other shortcuts use the sharedHOTKEYSmap. Consider adding entries for “Open in last used app” and “Copy path” toHOTKEYSand referencing them here for consistency and easier remapping later (and to keep the labels in sync withWorkspaceHeader’s tooltip text).apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx (1)
22-49: MakeExternalAppandAPP_OPTIONSless brittle and more reusableThe component logic looks good, but two small maintainability points:
getAppOptionfalls back toAPP_OPTIONS[1](currently “Cursor”), which is easy to break ifAPP_OPTIONSis reordered. Prefer an explicit default, e.g. aDEFAULT_APP_ID: ExternalApp = "cursor"constant andAPP_OPTIONS.find(...) ?? APP_OPTIONS.find(a => a.id === DEFAULT_APP_ID)!.- This
ExternalAppunion +APP_OPTIONSduplicates the app list already encoded in the TRPC routers (settings + external). Pulling the type and options from a shared module would keep the menu, settings, and backend validation in lockstep.apps/desktop/src/lib/trpc/routers/external/index.ts (1)
7-18: External app routing looks correct; consider sharingExternalAppand tightening small detailsThe new
ExternalAppenum +getAppCommand+openInApp/copyPathimplementations are coherent and match the macOS toolchain this feature targets (open -a, Finder, iTerm, Warp, etc.). Two follow-ups to consider:
- The allowed app set is now encoded here, in the settings router, and in
WorkspaceHeader. Centralising the enum/union and maybeAPP_OPTIONSin a shared module would prevent drift between backend validation and UI options.copyPathis declaredasyncbut doesn’tawaitanything; you could dropasyncto make it clear it’s synchronous. (Same pattern exists elsewhere, so this is purely a style/clarity tweak.)As per coding guidelines, keeping all external-app IPC going through this TRPC router is the right place for these Electron/Node integrations.
Also applies to: 22-44, 87-118
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (7)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/cursor.svgis excluded by!**/*.svgapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/finder.pngis excluded by!**/*.pngapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/iterm.pngis excluded by!**/*.pngapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/terminal.pngis excluded by!**/*.pngapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/vscode.svgis excluded by!**/*.svgapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/warp.pngis excluded by!**/*.pngapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/xcode.svgis excluded by!**/*.svg
📒 Files selected for processing (8)
apps/desktop/src/lib/trpc/routers/external/index.ts(2 hunks)apps/desktop/src/lib/trpc/routers/index.ts(2 hunks)apps/desktop/src/lib/trpc/routers/settings/index.ts(1 hunks)apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts(1 hunks)apps/desktop/src/main/lib/menu.ts(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
apps/desktop/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
For Electron interprocess communication, ALWAYS use tRPC as defined in
src/lib/trpc
Files:
apps/desktop/src/lib/trpc/routers/index.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/main/lib/menu.tsapps/desktop/src/lib/trpc/routers/external/index.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.tsapps/desktop/src/lib/trpc/routers/settings/index.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
apps/desktop/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
apps/desktop/**/*.{ts,tsx}: Please use alias as defined intsconfig.jsonwhen possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary
Files:
apps/desktop/src/lib/trpc/routers/index.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/main/lib/menu.tsapps/desktop/src/lib/trpc/routers/external/index.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.tsapps/desktop/src/lib/trpc/routers/settings/index.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Avoid usinganytype - use explicit types instead for type safety
Use camelCase for variable and function names following existing codebase patterns
Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Follow existing patterns and match the codebase style when writing new code
Files:
apps/desktop/src/lib/trpc/routers/index.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/main/lib/menu.tsapps/desktop/src/lib/trpc/routers/external/index.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.tsapps/desktop/src/lib/trpc/routers/settings/index.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
apps/desktop/src/lib/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules in shared code like
src/lib/electron-router-dom.ts- this code runs in both main and renderer processes
Files:
apps/desktop/src/lib/trpc/routers/index.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/lib/trpc/routers/external/index.tsapps/desktop/src/lib/trpc/routers/settings/index.ts
**/components/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
**/components/**/*.tsx: Create one folder per component with structure:ComponentName/ComponentName.tsx+index.tsfor barrel export
Co-locate tests next to the component file they test (e.g.,ComponentName.test.tsx)
Co-locate dependencies (utils, hooks, constants, config, stories) next to the file using them
Use nestedcomponents/subdirectory within a parent component only if a sub-component is used 2+ times within that parent; otherwise keep it in the parent'scomponents/folder
One component per file - avoid multi-component files
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules (fs, path, os, net, etc.) in renderer process code - browser environment only
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
apps/desktop/src/renderer/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Call IPC methods using
window.ipcRenderer.invoke()with object parameters - TypeScript will infer the exact response type automatically
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
apps/desktop/src/main/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Node.js modules (fs, path, os, net, etc.) can be used in main process code only
Files:
apps/desktop/src/main/lib/menu.ts
🧠 Learnings (5)
📚 Learning: 2025-11-24T21:33:13.244Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.244Z
Learning: Applies to apps/desktop/**/*.{ts,tsx} : Please use alias as defined in `tsconfig.json` when possible
Applied to files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to apps/desktop/src/lib/**/*.ts : Never import Node.js modules in shared code like `src/lib/electron-router-dom.ts` - this code runs in both main and renderer processes
Applied to files:
apps/desktop/src/main/lib/menu.tsapps/desktop/src/lib/trpc/routers/external/index.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts
📚 Learning: 2025-11-24T21:33:13.244Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.244Z
Learning: Applies to apps/desktop/**/*.{ts,tsx,js,jsx} : For Electron interprocess communication, ALWAYS use tRPC as defined in `src/lib/trpc`
Applied to files:
apps/desktop/src/main/lib/menu.tsapps/desktop/src/lib/trpc/routers/external/index.ts
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to apps/desktop/src/main/**/*.{ts,tsx} : Node.js modules (fs, path, os, net, etc.) can be used in main process code only
Applied to files:
apps/desktop/src/main/lib/menu.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to apps/desktop/src/renderer/**/*.{ts,tsx} : Never import Node.js modules (fs, path, os, net, etc.) in renderer process code - browser environment only
Applied to files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts
🧬 Code graph analysis (4)
apps/desktop/src/lib/trpc/routers/index.ts (1)
apps/desktop/src/lib/trpc/routers/settings/index.ts (1)
createSettingsRouter(20-29)
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts (1)
apps/desktop/src/lib/trpc/routers/workspaces/utils/worktree.ts (1)
getWorktreePath(6-9)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsx (3)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/index.tsx (1)
Sidebar(8-55)apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx (1)
WorkspaceHeader(54-149)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx (1)
ContentView(5-13)
apps/desktop/src/lib/trpc/routers/settings/index.ts (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx (1)
ExternalApp(22-29)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build
🔇 Additional comments (5)
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts (1)
192-195: AugmentinggetActivewithworktreePathlooks consistent and safeReturning
{ ...workspace, worktreePath: getWorktreePath(...) ?? "" }matches the pattern ingetAllGroupedand lets the UI gate features on the presence of a non-empty path. Callers already null/emptiness-check, so this is a backward-compatible extension.apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts (1)
1-1: Barrel re-export forWorkspaceHeader/ExternalAppis appropriateClean re-export that matches the component-folder pattern and keeps consumer imports tidy.
apps/desktop/src/lib/trpc/routers/index.ts (1)
6-24: Settings router integration intocreateAppRouterlooks correctImporting
createSettingsRouterand exposing it undersettingskeeps the router composition consistent with other domains (projects,workspaces,external) and matches how the renderer is callingtrpc.settings.*.apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsx (1)
93-99: Workspace header integration and layout changes look soundWrapping the content in a flex column, rendering
WorkspaceHeaderonly whenactiveWorkspace.worktreePathis truthy, and keepingContentViewin a flex-1 container preserves layout while cleanly gating the new actions on a valid path.apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx (1)
54-84: TRPC wiring and interaction handlers are straightforwardUsing
trpc.settings.getLastUsedApp/setLastUsedAppplustrpc.external.openInAppandcopyPathis a clean way to keep last-used state in TRPC while delegating side effects to the main process. Handlers correctly update the setting before invoking the external app and close the dropdown where appropriate.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/ui/package.json (1)
6-31: Missing exports for new toggle components.The PR adds
toggle.tsxandtoggle-group.tsxcomponents and their Radix UI dependencies (lines 46-47), but theexportsfield does not include entries for these components. Without exports, consuming packages cannot import these new components.Add the missing exports:
"./button": "./src/components/button.tsx", "./button-group": "./src/components/button-group.tsx", + "./toggle": "./src/components/toggle.tsx", + "./toggle-group": "./src/components/toggle-group.tsx", "./input": "./src/components/input.tsx",
🧹 Nitpick comments (4)
packages/ui/src/components/toggle-group.tsx (1)
51-81: Consider simplifying complex conditional styling.The
data-[spacing=0]:...selectors on line 73 create complex conditional styling rules. While functional, this approach may be difficult to maintain. Consider extracting this logic into a separate variant or using a more explicit class composition approach.apps/desktop/src/main/lib/db/schemas.ts (1)
39-51: Avoid triplicating ExternalApp definitions across main, router, and rendererYou now have three separate sources of truth for the same app set: this
ExternalAppunion, the ZodExternalAppenum inapps/desktop/src/lib/trpc/routers/external/index.ts, and a duplicated union inWorkspaceHeader.tsx. That’s brittle if you ever add/remove an app.Consider extracting a shared
externalAppsdefinition (e.g. aconst externalApps = [...] as constplustype ExternalApp = (typeof externalApps)[number]) in a small shared module, and have:
- this schema,
- the external router’s Zod enum (
z.enum(externalApps)),- and the renderer’s
ExternalApptypeall consume it. That keeps types and runtime validation in sync with minimal duplication. As per coding guidelines, this shared module can live under
apps/desktop/src/liband remain Node-free.apps/desktop/src/lib/trpc/routers/external/index.ts (2)
3-45: Centralize ExternalApp list to keep Zod schema and TS types in syncHere you introduce a Zod
ExternalAppenum andExternalAppType, whileapps/desktop/src/main/lib/db/schemas.tsexports a TSExternalAppunion andWorkspaceHeader.tsxdefines the same union again. Keeping three copies of the app list in sync is error-prone.Consider:
- Defining a single
externalAppsas constarray in a small shared module (underapps/desktop/src/lib/**so it’s Node-free).- Exporting both:
export type ExternalApp = (typeof externalApps)[number];export const ExternalAppSchema = z.enum(externalApps);- Consuming
ExternalAppSchemahere and in the settings router, and the TSExternalApptype in the DB schema and renderer.That removes string literal drift and keeps runtime validation and DB/renderer types aligned. Based on learnings, this also respects the separation between shared lib code and main-only Node imports.
88-124: Clarify semantics of lastUsedApp persistence and consider minor ergonomics tweaksA couple of small behavioral and polish points around
openInAppandcopyPath:
- You persist
lastUsedAppviadb.updatebefore attempting to spawn the external process. If the spawn fails (e.g. CLI not installed), the stored value still changes. If you want “last successfully used app” semantics, consider moving thedb.updateinto the success path afterspawnAsync(and after the Finder early-return). Otherwise, maybe add a short comment that it’s intentionally “last attempted app” to avoid confusion.- The debug
console.log/console.errorcalls in the router will run in production; if you have a central logging/telemetry helper, wiring these through that (or gating them behind a debug flag) would keep logs cleaner long-term.copyPathis fine as-is, though the handler doesn’t need to beasyncsinceclipboard.writeTextis synchronous; not important, but you could dropasyncfor a slightly clearer signal that it can’t reject.These are all non-blocking, but addressing them would tighten the behavior and maintainability. As per coding guidelines, this keeps tRPC surface minimal while refining behavior.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
apps/desktop/src/lib/trpc/routers/external/index.ts(2 hunks)apps/desktop/src/lib/trpc/routers/settings/index.ts(1 hunks)apps/desktop/src/main/lib/db/schemas.ts(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx(1 hunks)packages/ui/package.json(2 hunks)packages/ui/src/components/button-group.tsx(1 hunks)packages/ui/src/components/toggle-group.tsx(1 hunks)packages/ui/src/components/toggle.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Avoid usinganytype - use explicit types instead for type safety
Use camelCase for variable and function names following existing codebase patterns
Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Follow existing patterns and match the codebase style when writing new code
Files:
packages/ui/src/components/toggle-group.tsxapps/desktop/src/lib/trpc/routers/external/index.tspackages/ui/src/components/toggle.tsxapps/desktop/src/lib/trpc/routers/settings/index.tspackages/ui/src/components/button-group.tsxapps/desktop/src/main/lib/db/schemas.ts
**/components/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
**/components/**/*.tsx: Create one folder per component with structure:ComponentName/ComponentName.tsx+index.tsfor barrel export
Co-locate tests next to the component file they test (e.g.,ComponentName.test.tsx)
Co-locate dependencies (utils, hooks, constants, config, stories) next to the file using them
Use nestedcomponents/subdirectory within a parent component only if a sub-component is used 2+ times within that parent; otherwise keep it in the parent'scomponents/folder
One component per file - avoid multi-component files
Files:
packages/ui/src/components/toggle-group.tsxpackages/ui/src/components/toggle.tsxpackages/ui/src/components/button-group.tsx
packages/ui/src/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Use shadcn/ui components and TailwindCSS v4 for all UI component styling in the shared UI package
Files:
packages/ui/src/components/toggle-group.tsxpackages/ui/src/components/toggle.tsxpackages/ui/src/components/button-group.tsx
apps/desktop/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
For Electron interprocess communication, ALWAYS use tRPC as defined in
src/lib/trpc
Files:
apps/desktop/src/lib/trpc/routers/external/index.tsapps/desktop/src/lib/trpc/routers/settings/index.tsapps/desktop/src/main/lib/db/schemas.ts
apps/desktop/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
apps/desktop/**/*.{ts,tsx}: Please use alias as defined intsconfig.jsonwhen possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary
Files:
apps/desktop/src/lib/trpc/routers/external/index.tsapps/desktop/src/lib/trpc/routers/settings/index.tsapps/desktop/src/main/lib/db/schemas.ts
apps/desktop/src/lib/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules in shared code like
src/lib/electron-router-dom.ts- this code runs in both main and renderer processes
Files:
apps/desktop/src/lib/trpc/routers/external/index.tsapps/desktop/src/lib/trpc/routers/settings/index.ts
apps/desktop/src/main/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Node.js modules (fs, path, os, net, etc.) can be used in main process code only
Files:
apps/desktop/src/main/lib/db/schemas.ts
🧠 Learnings (10)
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to packages/ui/src/**/*.tsx : Use shadcn/ui components and TailwindCSS v4 for all UI component styling in the shared UI package
Applied to files:
packages/ui/src/components/toggle-group.tsxpackages/ui/src/components/toggle.tsxpackages/ui/src/components/button-group.tsxpackages/ui/package.json
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to **/components/**/*.tsx : Co-locate dependencies (utils, hooks, constants, config, stories) next to the file using them
Applied to files:
packages/ui/src/components/toggle-group.tsxpackages/ui/package.json
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to **/*.{ts,tsx} : Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Applied to files:
packages/ui/src/components/toggle-group.tsx
📚 Learning: 2025-11-24T21:33:13.244Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.244Z
Learning: Applies to apps/desktop/**/*.{ts,tsx,js,jsx} : For Electron interprocess communication, ALWAYS use tRPC as defined in `src/lib/trpc`
Applied to files:
apps/desktop/src/lib/trpc/routers/external/index.ts
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to apps/desktop/src/lib/**/*.ts : Never import Node.js modules in shared code like `src/lib/electron-router-dom.ts` - this code runs in both main and renderer processes
Applied to files:
apps/desktop/src/lib/trpc/routers/external/index.ts
📚 Learning: 2025-11-24T21:33:13.244Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.244Z
Learning: Applies to apps/desktop/**/*.{ts,tsx} : Please use alias as defined in `tsconfig.json` when possible
Applied to files:
apps/desktop/src/main/lib/db/schemas.tspackages/ui/package.json
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to **/components/**/*.tsx : Create one folder per component with structure: `ComponentName/ComponentName.tsx` + `index.ts` for barrel export
Applied to files:
packages/ui/package.json
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to **/components/**/*.tsx : One component per file - avoid multi-component files
Applied to files:
packages/ui/package.json
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to apps/desktop/src/main/**/*.{ts,tsx} : Node.js modules (fs, path, os, net, etc.) can be used in main process code only
Applied to files:
packages/ui/package.json
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to apps/desktop/src/renderer/**/*.{ts,tsx} : Never import Node.js modules (fs, path, os, net, etc.) in renderer process code - browser environment only
Applied to files:
packages/ui/package.json
🧬 Code graph analysis (6)
packages/ui/src/components/toggle-group.tsx (2)
packages/ui/src/components/toggle.tsx (1)
toggleVariants(45-45)packages/ui/src/lib/utils.ts (1)
cn(4-6)
apps/desktop/src/lib/trpc/routers/external/index.ts (3)
apps/desktop/src/main/lib/db/schemas.ts (1)
ExternalApp(39-46)apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx (1)
ExternalApp(23-30)apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts (1)
ExternalApp(1-1)
packages/ui/src/components/toggle.tsx (1)
packages/ui/src/lib/utils.ts (1)
cn(4-6)
apps/desktop/src/lib/trpc/routers/settings/index.ts (1)
apps/desktop/src/lib/trpc/index.ts (1)
router(15-15)
packages/ui/src/components/button-group.tsx (1)
packages/ui/src/lib/utils.ts (1)
cn(4-6)
apps/desktop/src/main/lib/db/schemas.ts (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx (1)
ExternalApp(23-30)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build
🔇 Additional comments (6)
packages/ui/src/components/button-group.tsx (1)
5-15: LGTM! Clean and functional component.The ButtonGroup implementation is straightforward and follows TailwindCSS v4 patterns correctly. The use of negative spacing and conditional border-radius selectors for child elements is appropriate for a button group layout.
packages/ui/package.json (1)
46-47: Dependencies added correctly.The Radix UI toggle dependencies are appropriately added to support the new Toggle and ToggleGroup components.
packages/ui/src/components/toggle.tsx (1)
1-45: LGTM! Well-structured Toggle component.The implementation follows shadcn/ui patterns correctly:
- Proper use of Radix UI primitives
- Type-safe variants with
class-variance-authority- Comprehensive styling with TailwindCSS v4
- Exports both the component and variants for reusability
packages/ui/src/components/toggle-group.tsx (2)
10-18: Good use of React Context.The ToggleGroupContext pattern for sharing variant, size, and spacing props between parent and children is a clean approach that avoids prop drilling.
37-39: Now let me search for TailwindCSS v4 documentation to verify the correct syntax:TailwindCSS v4 arbitrary value syntax CSS custom properties spacing functionapps/desktop/src/lib/trpc/routers/settings/index.ts (1)
1-10: Settings router implementation looks good and matches the intended behavior
getLastUsedAppcorrectly reads fromdb.data.settings.lastUsedAppand falls back to"cursor", and you’re using themain/lib/dbalias as per the desktop tsconfig. No functional or structural issues from this file alone.
| @@ -0,0 +1,17 @@ | |||
| import * as React from "react"; | |||
|
|
|||
| import { cn } from "../lib/utils"; | |||
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Use path alias for consistency.
The import uses a relative path "../lib/utils", but toggle.tsx and toggle-group.tsx in this same PR use the "@/lib/utils" alias. This inconsistency should be resolved.
Apply this diff:
-import { cn } from "../lib/utils";
+import { cn } from "@/lib/utils";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { cn } from "../lib/utils"; | |
| import { cn } from "@/lib/utils"; |
🤖 Prompt for AI Agents
In packages/ui/src/components/button-group.tsx around line 3, the import uses a
relative path "../lib/utils" while other components in this PR use the
"@/lib/utils" path alias; update the import to use "@/lib/utils" for consistency
with the rest of the codebase and ensure any tooling/tsconfig path mapping
supports the alias.
- Add lastUsedApp to Settings schema in lowdb - Save lastUsedApp in openInApp mutation (no separate setter) - Add ButtonGroup component to @superset/ui - Use ButtonGroup in WorkspaceHeader for proper styling - Remove redundant setLastUsedApp mutation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Move WorkspaceHeader from WorkspaceView to TopBar (right side before settings) - Update EmptyTabView to show Open in App shortcut instead of Split Horizontal - Rename OPEN_REPO to OPEN_IN_APP in hotkeys for clarity - Remove border styling from WorkspaceHeader since it's now in TopBar - Fix lint issues with import organization 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
22dd4bd to
d285090
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (7)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsx (2)
72-79: Use the centralizedHOTKEYSconstant for consistency.The hotkey string is hardcoded as
"meta+o"whileHOTKEYS.OPEN_IN_APPis already imported. Using the constant ensures the binding stays in sync with the centralized definition.- useHotkeys("meta+o", () => { + useHotkeys(HOTKEYS.OPEN_IN_APP.keys, () => {
81-87: Consider adding a centralizedCOPY_PATHhotkey definition.The copy path shortcut (
meta+shift+c) is hardcoded here but not defined inshared/hotkeys.ts. For consistency with other shortcuts (and to show it in the keyboard shortcuts modal), consider adding aCOPY_PATHentry toHOTKEYS.apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx (1)
48-49: Consider using a named default instead of index access.
APP_OPTIONS[1]relies on array order. IfAPP_OPTIONSis reordered, the fallback silently changes. A safer approach:+const DEFAULT_APP: AppOption = { id: "cursor", label: "Cursor", icon: cursorIcon }; + const getAppOption = (id: ExternalApp) => - APP_OPTIONS.find((app) => app.id === id) ?? APP_OPTIONS[1]; + APP_OPTIONS.find((app) => app.id === id) ?? DEFAULT_APP;apps/desktop/src/lib/trpc/routers/external/index.ts (4)
8-19: Avoid duplicatingExternalAppunion across modulesThe
ExternalAppliterals here match theExternalApptype inapps/desktop/src/main/lib/db/schemas.tsand inWorkspaceHeader.tsx. Maintaining three separate definitions is brittle and easy to drift.Consider centralizing the source of truth, e.g.:
- In
schemas.ts: export a singleexternalAppValuesas constarray and deriveExternalAppfrom it.- Here:
const ExternalApp = z.enum(externalAppValues);- In the renderer: import the same
ExternalApptype (or values) instead of re-declaring.This keeps TRPC validation, DB schema, and UI in sync.
23-45: Command mapping looks correct; consider platform/command availability handling
getAppCommandcleanly maps eachExternalAppTypeto a CLI invocation, and usingspawn(command, args)avoids shell injection issues. Mac-specific apps/commands (open,Xcode,iTerm,Warp,Terminal) are hard-coded, which is fine if the desktop app is macOS-only.If you expect non-macOS environments or missing CLI tools, consider:
- Short-circuiting for
process.platform !== "darwin"with a clearer error.- Optionally distinguishing “app not installed/command not found” (
ENOENT) from generic failures so the UI can show a more helpful message.Not blocking, but worth aligning with your supported platforms.
88-121:openInAppflow is solid; clarify semantics of “last used app”The procedure wiring looks good:
- Validated input with
z.object.- Persists
lastUsedAppviadb.update.- Special-cases Finder via
shell.showItemInFolder.- Uses
getAppCommand+spawnAsyncwith logging and error propagation.One behavioral nuance:
lastUsedAppis updated before attempting to launch the app and remains updated even ifspawnAsyncfails (e.g., app not installed or CLI not inPATH). That effectively means “last selected app”, not strictly “last successfully opened app”, which might cause ⌘O to keep retrying a broken choice.If you’d prefer “last successful app”, consider updating the DB only after a successful open (including the Finder branch), e.g.:
- Move the
db.updatecall:
- Into the Finder branch after
shell.showItemInFolder, and- After a successful
spawnAsyncfor other apps.This is a behavioral/UX choice, not a correctness bug.
122-125:copyPathis straightforward; consider dropping unnecessaryasync
copyPathcleanly bridges the renderer toelectron.clipboardand does only a simple side-effect. Sinceclipboard.writeTextis synchronous and you’re not awaiting anything, you can omitasyncto avoid an unnecessary Promise:- copyPath: publicProcedure.input(z.string()).mutation(async ({ input }) => { - clipboard.writeText(input); - }), + copyPath: publicProcedure.input(z.string()).mutation(({ input }) => { + clipboard.writeText(input); + }),Purely a small cleanup; behavior is already correct.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (8)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/cursor.svgis excluded by!**/*.svgapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/finder.pngis excluded by!**/*.pngapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/iterm.pngis excluded by!**/*.pngapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/terminal.pngis excluded by!**/*.pngapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/vscode.svgis excluded by!**/*.svgapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/warp.pngis excluded by!**/*.pngapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/assets/xcode.svgis excluded by!**/*.svgbun.lockis excluded by!**/*.lock
📒 Files selected for processing (16)
apps/desktop/src/lib/trpc/routers/external/index.ts(2 hunks)apps/desktop/src/lib/trpc/routers/index.ts(2 hunks)apps/desktop/src/lib/trpc/routers/settings/index.ts(1 hunks)apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts(1 hunks)apps/desktop/src/main/lib/db/schemas.ts(1 hunks)apps/desktop/src/main/lib/menu.ts(1 hunks)apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx(2 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/EmptyTabView.tsx(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsx(1 hunks)apps/desktop/src/shared/hotkeys.ts(1 hunks)packages/ui/package.json(2 hunks)packages/ui/src/components/button-group.tsx(1 hunks)packages/ui/src/components/toggle-group.tsx(1 hunks)packages/ui/src/components/toggle.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
- packages/ui/src/components/button-group.tsx
- apps/desktop/src/main/lib/menu.ts
- apps/desktop/src/lib/trpc/routers/settings/index.ts
- packages/ui/package.json
- apps/desktop/src/main/lib/db/schemas.ts
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts
- apps/desktop/src/lib/trpc/routers/index.ts
- apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts
🧰 Additional context used
📓 Path-based instructions (8)
apps/desktop/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
For Electron interprocess communication, ALWAYS use tRPC as defined in
src/lib/trpc
Files:
apps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/EmptyTabView.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsxapps/desktop/src/shared/hotkeys.tsapps/desktop/src/lib/trpc/routers/external/index.ts
apps/desktop/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
apps/desktop/**/*.{ts,tsx}: Please use alias as defined intsconfig.jsonwhen possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary
Files:
apps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/EmptyTabView.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsxapps/desktop/src/shared/hotkeys.tsapps/desktop/src/lib/trpc/routers/external/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Avoid usinganytype - use explicit types instead for type safety
Use camelCase for variable and function names following existing codebase patterns
Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Follow existing patterns and match the codebase style when writing new code
Files:
apps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/EmptyTabView.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxpackages/ui/src/components/toggle.tsxpackages/ui/src/components/toggle-group.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsxapps/desktop/src/shared/hotkeys.tsapps/desktop/src/lib/trpc/routers/external/index.ts
**/components/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
**/components/**/*.tsx: Create one folder per component with structure:ComponentName/ComponentName.tsx+index.tsfor barrel export
Co-locate tests next to the component file they test (e.g.,ComponentName.test.tsx)
Co-locate dependencies (utils, hooks, constants, config, stories) next to the file using them
Use nestedcomponents/subdirectory within a parent component only if a sub-component is used 2+ times within that parent; otherwise keep it in the parent'scomponents/folder
One component per file - avoid multi-component files
Files:
apps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/EmptyTabView.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxpackages/ui/src/components/toggle.tsxpackages/ui/src/components/toggle-group.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules (fs, path, os, net, etc.) in renderer process code - browser environment only
Files:
apps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/EmptyTabView.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
apps/desktop/src/renderer/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Call IPC methods using
window.ipcRenderer.invoke()with object parameters - TypeScript will infer the exact response type automatically
Files:
apps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/EmptyTabView.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
packages/ui/src/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Use shadcn/ui components and TailwindCSS v4 for all UI component styling in the shared UI package
Files:
packages/ui/src/components/toggle.tsxpackages/ui/src/components/toggle-group.tsx
apps/desktop/src/lib/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules in shared code like
src/lib/electron-router-dom.ts- this code runs in both main and renderer processes
Files:
apps/desktop/src/lib/trpc/routers/external/index.ts
🧠 Learnings (5)
📚 Learning: 2025-11-24T21:33:13.244Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.244Z
Learning: Applies to apps/desktop/**/*.{ts,tsx} : Please use alias as defined in `tsconfig.json` when possible
Applied to files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to packages/ui/src/**/*.tsx : Use shadcn/ui components and TailwindCSS v4 for all UI component styling in the shared UI package
Applied to files:
packages/ui/src/components/toggle.tsxpackages/ui/src/components/toggle-group.tsx
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to **/components/**/*.tsx : Co-locate dependencies (utils, hooks, constants, config, stories) next to the file using them
Applied to files:
packages/ui/src/components/toggle-group.tsx
📚 Learning: 2025-11-24T21:33:13.244Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.244Z
Learning: Applies to apps/desktop/**/*.{ts,tsx,js,jsx} : For Electron interprocess communication, ALWAYS use tRPC as defined in `src/lib/trpc`
Applied to files:
apps/desktop/src/lib/trpc/routers/external/index.ts
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to apps/desktop/src/lib/**/*.ts : Never import Node.js modules in shared code like `src/lib/electron-router-dom.ts` - this code runs in both main and renderer processes
Applied to files:
apps/desktop/src/lib/trpc/routers/external/index.ts
🧬 Code graph analysis (6)
apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx (1)
WorkspaceHeader(55-140)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/EmptyTabView.tsx (1)
apps/desktop/src/shared/hotkeys.ts (1)
HOTKEYS(28-141)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsx (2)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/index.tsx (1)
Sidebar(8-55)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx (1)
ContentView(5-13)
packages/ui/src/components/toggle.tsx (1)
packages/ui/src/lib/utils.ts (1)
cn(4-6)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx (1)
apps/desktop/src/main/lib/db/schemas.ts (1)
ExternalApp(39-46)
apps/desktop/src/lib/trpc/routers/external/index.ts (3)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx (1)
ExternalApp(23-30)apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts (1)
ExternalApp(1-1)apps/desktop/src/main/lib/db/schemas.ts (1)
ExternalApp(39-46)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build
🔇 Additional comments (13)
packages/ui/src/components/toggle-group.tsx (2)
9-17: LGTM!Context setup correctly shares variant configuration with child items, with sensible defaults matching the component's prop defaults.
50-80: LGTM!The
ToggleGroupItemcorrectly consumes context values with appropriate fallback to local props, and the conditional styling fordata-[spacing=0]properly handles the compact grouped appearance with border and radius adjustments.packages/ui/src/components/toggle.tsx (3)
7-27: LGTM!The
toggleVariantsdefinition follows shadcn/ui patterns well with clear variant and size options. The styling includes appropriate focus, hover, and disabled states.
29-43: LGTM!Clean component implementation that correctly composes styling via
toggleVariantsandcn(), with proper prop forwarding to the Radix primitive.
45-45: LGTM!Exporting
toggleVariantsalongside the component enables proper style reuse inToggleGroupItem, maintaining consistent styling across related components.apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/EmptyTabView.tsx (1)
5-5: LGTM!The shortcut hint update correctly reflects the new
OPEN_IN_APPhotkey, providing users with a helpful hint about the ⌘O shortcut in the empty terminal state.apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx (1)
10-10: LGTM!The integration of
WorkspaceHeaderis clean. The optional chaining guard onactiveWorkspace?.worktreePathcorrectly ensures the header only renders when a valid path exists.Also applies to: 26-28
apps/desktop/src/shared/hotkeys.ts (1)
128-133: LGTM!The
OPEN_IN_APPhotkey definition is well-structured with a clear label and helpful description. The ⌘O binding is intuitive for an "open" action.apps/desktop/src/renderer/screens/main/components/WorkspaceView/index.tsx (1)
92-95: LGTM!The layout refactor with nested flex containers and overflow handling is clean and provides proper containment for the content area.
apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx (3)
55-84: LGTM!The component logic is well-structured with clear separation of concerns. The cache invalidation on
openInAppsuccess ensures the UI reflects the updatedlastUsedApp, and the handlers are appropriately scoped.
85-139: LGTM!The UI implementation is clean with good accessibility (
aria-label,titleattributes). The dropdown structure with keyboard shortcut hints (⌘O, ⌘⇧C) provides clear affordances for users.
23-30: ExternalApp type duplication is valid but the suggested fix won't work — cannot import fromschemas.tsin renderer process code.
ExternalAppis defined in three places:schemas.ts(main process), the external router, and locally in this component. However, the renderer process cannot import fromschemas.tsdue to the IPC boundary.Instead, export
ExternalAppTypefrom the external router (apps/desktop/src/lib/trpc/routers/external/index.ts) and import it here fromrenderer/lib/trpc, or use tRPC'sinferRouterInputsto derive the type. Defining it locally in this component works but creates a maintenance burden if the type changes.apps/desktop/src/lib/trpc/routers/external/index.ts (1)
3-5: Imports are appropriate for main-process routerUsing
electron(clipboard, shell) andmain/lib/dbhere is consistent with this router running in the Electron main process and with the guideline that shared renderer-safe code (likeelectron-router-dom) must avoid Node/Electron imports. No changes needed.Based on learnings, this stays within the “main-only, not shared” bucket.
| style={{ "--gap": spacing } as React.CSSProperties} | ||
| className={cn( | ||
| "group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs", | ||
| className, | ||
| )} |
There was a problem hiding this comment.
Data attribute selector mismatch and potentially invalid spacing syntax.
Two issues in this styling:
-
data-[spacing=default](line 38) will never match becausespacingis a number (default0), not the string"default". -
gap-[--spacing(var(--gap))]syntax appears incorrect. If using Tailwind v4's--spacing()theme function, it expects a spacing scale key, butvar(--gap)returns the raw numeric value set on line 36.
Consider this fix:
style={{ "--gap": spacing } as React.CSSProperties}
className={cn(
- "group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",
+ "group/toggle-group flex w-fit items-center rounded-md data-[spacing=0]:data-[variant=outline]:shadow-xs",
+ spacing > 0 && `gap-${spacing}`,
className,
)}Alternatively, if arbitrary gap values are needed:
- "group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",
+ "group/toggle-group flex w-fit items-center gap-[calc(var(--gap)*0.25rem)] rounded-md data-[spacing=0]:data-[variant=outline]:shadow-xs",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| style={{ "--gap": spacing } as React.CSSProperties} | |
| className={cn( | |
| "group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs", | |
| className, | |
| )} | |
| style={{ "--gap": spacing } as React.CSSProperties} | |
| className={cn( | |
| "group/toggle-group flex w-fit items-center gap-[calc(var(--gap)*0.25rem)] rounded-md data-[spacing=0]:data-[variant=outline]:shadow-xs", | |
| className, | |
| )} |
🤖 Prompt for AI Agents
In packages/ui/src/components/toggle-group.tsx around lines 36 to 40, the data
attribute selector and gap syntax are incorrect: data-[spacing=default] will
never match because spacing is a numeric value (default 0), and
gap-[--spacing(var(--gap))] is invalid Tailwind syntax. Fix by making the data
attribute match the actual value (e.g., data-[spacing=0] or set spacing to a
string like "default"), and change the gap handling to use a real CSS variable
or Tailwind arbitrary value — either set the inline style to include gap (e.g.,
style={{ "--gap": spacing, gap: "var(--gap)" }} with spacing including units) or
use a valid Tailwind arbitrary class like gap-[var(--gap)] (ensuring --gap
contains a unit) or map numeric spacing to theme keys before using gap-[...].
- Move EXTERNAL_APPS const array to main/lib/db/schemas.ts - Derive ExternalApp type from the const array - Update external router to use shared schema - Update WorkspaceHeader to import from shared location 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/desktop/src/lib/trpc/routers/external/index.ts (2)
3-36: Enum schema + command helper keep external app handling coherentDeriving
ExternalAppSchemafromEXTERNAL_APPSand usingExternalAppingetAppCommandnicely keeps validation and command mapping in sync with the DB schema. As a small optional hardening, you could make theswitchexhaustive so adding a new value toExternalAppfails at compile time instead of only at runtime:const getAppCommand = ( app: ExternalApp, targetPath: string, ): { command: string; args: string[] } | null => { switch (app) { // existing cases... case "terminal": return { command: "open", args: ["-a", "Terminal", targetPath] }; default: { const _exhaustiveCheck: never = app; return null; } } };This helps catch missing mappings when EXTERNAL_APPS is extended.
79-116: openInApp/copyPath flow looks good; consider a couple of robustness tweaksThe new tRPC mutations are consistent with the existing router—using zod for input, db-backed
lastUsedApp, andspawnAsync/Electron primitives for side effects, which aligns with the “IPC via tRPC only” guidance. As per coding guidelines and learnings, this keeps Electron calls behind the trpc layer.A few optional refinements to consider:
- Path normalization: To match
openFileInEditor, you could normalizeinput.path(home expansion +path.resolve) beforeshell.showItemInFolder/getAppCommand, reducing surprises with~or relative paths.- Settings vs. action failure coupling: If
db.updatethrows, the mutation currently fails before even trying to open the app. You might want to catch/log persistence errors but still attempt to launch the external app, since opening is the primary user intent.- copyPath input constraints: If you never intend to clear the clipboard via this API, tightening the schema to something like
z.string().min(1)would prevent accidentally writing empty strings.None of these are blockers, but they’d make the behavior a bit more resilient.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/desktop/src/lib/trpc/routers/external/index.ts(2 hunks)apps/desktop/src/main/lib/db/schemas.ts(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/index.ts
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/WorkspaceHeader/WorkspaceHeader.tsx
- apps/desktop/src/main/lib/db/schemas.ts
🧰 Additional context used
📓 Path-based instructions (4)
apps/desktop/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
For Electron interprocess communication, ALWAYS use tRPC as defined in
src/lib/trpc
Files:
apps/desktop/src/lib/trpc/routers/external/index.ts
apps/desktop/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
apps/desktop/**/*.{ts,tsx}: Please use alias as defined intsconfig.jsonwhen possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary
Files:
apps/desktop/src/lib/trpc/routers/external/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Avoid usinganytype - use explicit types instead for type safety
Use camelCase for variable and function names following existing codebase patterns
Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Follow existing patterns and match the codebase style when writing new code
Files:
apps/desktop/src/lib/trpc/routers/external/index.ts
apps/desktop/src/lib/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules in shared code like
src/lib/electron-router-dom.ts- this code runs in both main and renderer processes
Files:
apps/desktop/src/lib/trpc/routers/external/index.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.244Z
Learning: Applies to apps/desktop/**/*.{ts,tsx,js,jsx} : For Electron interprocess communication, ALWAYS use tRPC as defined in `src/lib/trpc`
📚 Learning: 2025-11-24T21:33:13.244Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.244Z
Learning: Applies to apps/desktop/**/*.{ts,tsx,js,jsx} : For Electron interprocess communication, ALWAYS use tRPC as defined in `src/lib/trpc`
Applied to files:
apps/desktop/src/lib/trpc/routers/external/index.ts
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to apps/desktop/src/lib/**/*.ts : Never import Node.js modules in shared code like `src/lib/electron-router-dom.ts` - this code runs in both main and renderer processes
Applied to files:
apps/desktop/src/lib/trpc/routers/external/index.ts
🧬 Code graph analysis (1)
apps/desktop/src/lib/trpc/routers/external/index.ts (1)
apps/desktop/src/main/lib/db/schemas.ts (2)
EXTERNAL_APPS(39-47)ExternalApp(49-49)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build
- Always render WorkspaceHeader to prevent layout drift - Add "Open" text next to chevron dropdown - Conditionally show folder button when worktreePath exists - Remove console.log statements from openInApp 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
96c8bdf to
5e1a5e7
Compare
Summary
Changes
externalTRPC router withopenInAppandcopyPathmutationssettingsTRPC router to store last used app preferenceWorkspaceHeadercomponent with button group UITest plan
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
UI
Shortcuts
Removed
✏️ Tip: You can customize this high-level summary in your review settings.